package com.baimawangzi.recovery.dao.impl;

import com.baimawangzi.recovery.bean.Admin;
import com.baimawangzi.recovery.dao.AdminDao;
import com.baimawangzi.recovery.util.dbutil.BeanHandler;

import java.util.List;

public class AdminDaoImpl extends BaseDaoImpl<Admin> implements AdminDao {
    public AdminDaoImpl() {
        clazz=Admin.class;
        init();
    }

    @Override
    public List<Admin> map(String sql, Object[] obj) {

        List<Admin> admins = queryRunner.query(sql, new BeanHandler<Admin>(clazz), obj);
        return admins;
    }

    @Override
    public List<Admin> getLogin(String loginname, String pwd) {
        String sql ="select *from t_admin where loginname= ? and password=md5(?)";
        Object[] obj={loginname,pwd};
        List<Admin> admins = map(sql, obj);
        return admins;
    }
}
